package com.definesys.smecrailtransit.module.LineReport.viewController;

import java.util.Calendar;
import java.util.Date;

/**
 * Created by cjy on 2018/1/15.
 */

public class ViewController {
    private Calendar date;
    private int faultCount;
    private int timeCount;
    private String faultHint;
    private String timeHint;

    public ViewController(){
        date = getPreviousDay();
        faultCount = 0;
        timeCount = 0;
    }


    public Calendar getDate() {
        return date;
    }

    public void setDate(Calendar date) {
        this.date = date;
    }

    public int getFaultCount() {
        return faultCount;
    }

    public void setFaultCount(int faultCount) {
        this.faultCount = faultCount;
    }

    public int getTimeCount() {
        return timeCount;
    }

    public void setTimeCount(int timeCount) {
        this.timeCount = timeCount;
    }

    public static Calendar getPreviousDay() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.DAY_OF_MONTH, -1);
        return calendar;
    }


    public String getFaultHint() {
        faultHint = String.valueOf(date.get(Calendar.MONTH)+1) + "月" + String.valueOf(date.get(Calendar.DATE)) + "日12号线共有" + String.valueOf(faultCount) + "台电梯发生故障";
        return faultHint;
    }

    public void setFaultHint(String faultHint) {
        this.faultHint = faultHint;
    }

    public String getTimeHint() {
        timeHint = String.valueOf(date.get(Calendar.MONTH)+1) + "月" + String.valueOf(date.get(Calendar.DATE)) + "日12号线共有" + String.valueOf(timeCount) + "台电梯运行时长低于70%";
        return timeHint;
    }

    public void setTimeHint(String timeHint) {
        this.timeHint = timeHint;
    }
}
